package world.conditions;

import java.math.BigDecimal;

import world.square.Rock;
import world.square.Square;
import world.square.TemperatureScale;

/**
 * A condition which checks whether a square has a temperature of at least 200 degrees celcius.
 * 
 * @author Frederic Mes, Wim Marynissen
 * @version 1.0
 */
public class ConditionAtLeast200Celcius implements Condition {
	
	/**
	 * Check if the square satisfies this condition.
	 * @return 	The square must be a rock.
	 * 			| if(!(square instanceof Rock))
	 * 			| 	then result == false	
	 * @return	The temperature of the rock must be at least 200 degrees celcius
	 * 			| if(!(square.getTemperature().getValue(TemperatureScale.CELCIUS)
	 * 			|				.compareTo(new BigDecimal("200")) > 0))
	 * 			| 	then result == false
	 */
	public boolean check(Square square) {
		return (square instanceof Rock 
					&& square.getTemperature().getValue(TemperatureScale.CELCIUS)
							.compareTo(new BigDecimal("200")) > 0);
		
	}

}
